package org.example.ideavr.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.ideavr.annotation.AutoFill;
import org.example.ideavr.pojo.dto.UserDTO;
import org.example.ideavr.pojo.entity.User;
import org.example.ideavr.pojo.vo.UserVO;

@Mapper
public interface UserMapper {

    //根据用户名查询
    @Select("SELECT * FROM user WHERE username = #{username}")
    User selectByUsername(String username);

    //插入员工
    @AutoFill
    @Insert("insert into user(username, password, email, create_time, update_time) " +
            "value (#{username}, #{password}, #{email}, #{createTime}, #{updateTime})")
    void insert(User user);

    @Select("SELECT * FROM user WHERE id = #{id}")
    UserVO selectById(Long id);

    void userUpdate(User user);
}
